<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>layui</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="../../../static/font-awesome-4.7.0/css/font-awesome.min.css" >
	<link rel="stylesheet" href="../../../static/vui/css/vui.css">
	<script type="text/javascript" src="../../../static/js/jquery-1.9.1.min.js"></script>
	<script type="text/javascript" src="../../../static/js/jquery.cookie.min.js"></script>
	<script src="../../../static/layer/layer.js"></script>
	<script src="../../../static/laydate/laydate.js"></script>
	<script type="text/javascript" src="../../../static/vui/js/vui.js"></script>
	<script type="text/javascript" src="../../../static/js/common.js"></script>
	<style>
		#file{
			opacity: 0;
			filter:alpha(opacity=0);
			-moz-opacity:0;
			-khtml-opacity: 0;display: block;position: absolute;z-index: 100;height: 30px;
			width: 60px;cursor: pointer;
		}
	</style>
</head>
<body >
	<div id="formArea" style="padding: 15px;">
		<form action="/crm/eimport/product" id="form"  method="post" enctype="multipart/form-data" target="uploadFrame">
			<input type="file" id="file" name="file"/>
		</form>
		<iframe style="width: 0px;height:0px;display: none;" id="uploadFrame" name="uploadFrame"></iframe>

		<table class="table">
			<tr>
				<td>
					<label class="label">选择文件</label>
				</td>
				<td>
					<input type="text" readonly="readonly" class="input" name="name" id="name"  autocomplete="off"/>
					<button class="button" id="view" style="margin-left: 0px;"><span>浏览</span></button>
				</td>
			</tr>
			<tr>
				<td>

				</td>
				<td style="text-align: left;">
					<button class="button" id="download" style="margin-left: 0px;"><span>下载模板</span></button>
				</td>
			</tr>
		</table>
	</div>
	<script>

		var o = app.getLogin();
		for( var n in o ){
		    $('#form').append('<input type="hidden" name="'+n+'" value="'+o[n]+'"/>');
		}

		$('#file').change(function () {
			$('#name').val($('#file').val());
        });

        var point = app.getElementPoint($('#view'));
        $('#file').css({"top":point.y+"px","left":point.x+"px"});

        app.getOkBtn().click(function(){
            layer.load();
            $('#form').submit();
		});

        function eimportComplete() {
            layer.closeAll('loading');
            app.msg(layer,'上传成功',1);
        }

        function eimportError(message) {
            layer.closeAll('loading');
            app.msg(layer,message,2);
        }

	</script>
</body>
</html>